<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                {% if domain_list %}
                <h4 class="heading-title">{{ domain_list|length }} Domains associated with organization {{organization.name}}</h4> {% for domain in domain_list %}
                <span class="badge badge-soft-primary m-1">{{domain.name}}</span> {% endfor %}
                <br>
                <br> {% endif %}
                <form method="POST" id="start-scan-form">
                    {% csrf_token %}
                    <div id="schedule_scan_steps">
                        <h3>Choose the scheduler</h3>
                        <div class="">
                            <div class="form-row">
                                <select class="form-select" onchange="schedulerChanged(this)" name="scheduled_mode" style="line-height: 2.0;">
                                    <option value="periodic">Periodic Scan</option>
                                    <option value="clocked">Clocked Scan</option>
                                </select>
                            </div>
                            <div class="tab-content" id="animateLineContent-4">
                                <div class="tab-pane fade show active" id="periodic-div" role="tabpanel" aria-labelledby="periodic-tab-tab">
                                    <div class="mb-4">
                                        <h5>Run scan every</h5>
                                        <div class="row">
                                            <div class='col-4'>
                                                <input id="t-text" type="number" name="frequency" value="30" class="form-control form-control-lg">
                                            </div>
                                            <div class="col-8">
                                                <select class="form-select" name="frequency_type" style="line-height: 2.0;">
                                                    <option value="minutes">Minutes</option>
                                                    <option value="hours">Hours</option>
                                                    <option value="days">Days</option>
                                                    <option value="weeks">Weeks</option>
                                                    <option value="months">Months</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="tab-pane fade" id="clocked-div" role="tabpanel" aria-labelledby="clocked-tab-tab">
                                    <div class="mb-4">
                                        <h5>Run scan exactly at</h5>
                                        <div class="row">
                                            <div class="col-12">
                                                <div class="form-group mb-0">
                                                    <!--<input id="clockedTime" value="{% now "Y-m-d H:i" %}" class="form-control flatpickr flatpickr-input active" type="text" placeholder="Select Date and time" name="scheduled_time">-->
                                                    <input type="text" id="clockedTime" class="form-control form-control-lg flatpickr flatpickr-input active" placeholder="Select Scheduler Date and time" name="scheduled_time">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <h3>Choose Scan Engine</h3>
                        <div class="">
                            <h4>Select Scan Engine</h4> {% if custom_engine_count == 0 %}
                            <div class="alert bg-soft-primary border-0 mb-4" role="alert">
                                <span><b>Tips! </b> You do not have any custom scan engines. Would you like to create your own scan engine?</span>
                                <a href="{% url 'add_engine' current_project.slug %}" class="text-primary">Create Custom Scan Engine</a>
                            </div>
                            {% endif %} {% include "startScan/_items/scanengine_accordion.html" %}
                        </div>
                        <h3>Import/Ignore Subdomains</h3>
                        <div class="">
                            <div class="mb-3">
                                <h4 class="text-info">Import Subdomains(Optional)</h4>
                                <span class="">You can import subdomains for <b>{{domain.name}}</b> using your private recon tools.</span>
                                <br>
                                <div class="alert bg-soft-primary border-0 mt-1 mb-1" role="alert">
                                    <span class="">Separate the subdomains using <b>new line</b>. If the subdomain does not belong to <b>{{domain.name}}</b> it will be skipped.</span>
                                </div>
                                <label for="importSubdomainFormControlTextarea" class="form-label mt-1">Subdomains List</label>
                                <textarea class="form-control" id="importSubdomainFormControlTextarea" name="importSubdomainTextArea" rows="6" spellcheck="false"></textarea>
                            </div>
                            <div class="mb-3">
                                <h4 class="text-warning">Out of Scope Subdomains (Optional)</h4>
                                <p>Specify subdomains of <strong>{{domain.name}}</strong> to exclude from scanning. These subdomains will be omitted from all subsequent scans, including URL discovery and vulnerability assessments.</p>
                                <p>Enter one subdomain or pattern per line. Both plain text and regex patterns are supported. <span class="badge bg-soft-primary text-primary ms-2">New</span></p>
                                <div class="mt-2 mb-2">
                                <li>For plain text: <code>admin.example.com</code></li>
                                <li>For regex: <code>^.*outofscope.*\.com$</code>, <code>admin.*</code> etc</li>
                                </div>
                                <label for="outOfScopeSubdomainTextarea" class="form-label mt-1">Out of Scope Subdomains List</label>
                                <textarea class="form-control" id="outOfScopeSubdomainTextarea" name="outOfScopeSubdomainTextarea" rows="6" spellcheck="false" placeholder="Enter subdomains or patterns, one per line"></textarea>
                            </div>
                        </div>
                        <h3>URL Scope and Exclusions</h3>
                        <div class="mb-4">
                            <div class="mb-3">
                                <h4 class="text-info">Starting Point Path (Optional)</h4>
                                <input type="email" class="form-control" id="startingPointPath" placeholder="e.g. /home" name="startingPointPath">
                                <small class="form-text text-muted">
                    Defines where the scan should begin. Leave blank to scan from the root (/) and include all subdomains.
                    <br>
                    If a path is provided (e.g., /home), the scan will focus only on that path and its subpaths,
                    skipping subdomain scanning. For example, entering '/home' for {{domain.name}} will scan
                    https://{{domain.name}}/home, but not other parts of {{domain.name}} or its subdomains.
                    </small>
                            </div>
                            <div class="mb-3">
                                <h4 class="text-warning">Excluded Paths (Optional)</h4>
                                <input type="text" id="excludedPaths" value="{{excluded_paths}}" name="excludedPaths">
                                <small class="form-text text-muted">
                    Enter paths or regex patterns to exclude from the scan. Type a path or pattern and press Enter to add it.
                    Supports both exact path matching and regex patterns. Examples:<br>
                    • <code>/admin</code> excludes paths starting with '/admin'<br>
                    • <code>/images/.*\.jpg</code> excludes all .jpg files in the images directory<br>
                    • <code>/static/(?:css|js)/</code> excludes all contents of /static/css/ and /static/js/<br>
                    <b>Common exclusions:</b><br>
                    • Static assets: <code>/images/.*</code>, <code>/css/.*</code><br>
                    <br>
                    <b>Note: Use regex patterns carefully. While exclusions can speed up scans, be cautious not to exclude critical
                        areas that may contain vulnerabilities. Test your patterns to ensure they match as intended.</b>
                    </small>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>